Bug 538782 – Make GtkMenu's arrow size themable
authorChristian Dywan <cdywan@src.gnome.org>
Wed, 24 Sep 2008 08:56:10 +0000 (08:56 +0000)
committerChristian Dywan <cdywan@src.gnome.org>
Wed, 24 Sep 2008 08:56:10 +0000 (08:56 +0000)
* gtk/gtkmenu.c (gtk_menu_class_init), (gtk_menu_paint):
Implement "arrow-scaling" style property in GtkMenu.

svn path=/trunk/; revision=21509

ChangeLog
gtk/gtkmenu.c

index 41fb04a4256d453177162daf4c7311589e01aa62..8c87977548b2e3877947635eda5cd771d93f10ce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-24  Christian Dywan  <christian@imendio.com>
+
+       Bug 538782 – Make GtkMenu's arrow size themable
+
+       * gtk/gtkmenu.c (gtk_menu_class_init), (gtk_menu_paint):
+        Implement "arrow-scaling" style property in GtkMenu.
+
 2008-09-24  Christian Dywan  <christian@imendio.com>
 
        Bug 408244 – add GtkDialog::content-area-spacing
index 9cfbdb19c8dc33164176d3cc76f4ea6b6fa1ebfb..13c2cbd9674c2c43acc05199c2c408740c0b4c50 100644 (file)
@@ -661,6 +661,20 @@ gtk_menu_class_init (GtkMenuClass *class)
                                                                -1, INT_MAX, -1,
                                                                GTK_PARAM_READWRITE));
 
+ /**
+  * GtkMenu::arrow-scaling
+  *
+  * Arbitrary constant to scale down the size of the scroll arrow.
+  *
+  * Since: 2.16
+  */
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_float ("arrow-scaling",
+                                                               P_("Arrow Scaling"),
+                                                               P_("Arbitrary constant to scale down the size of the scroll arrow"),
+                                                               0.0, 1.0, 0.7,
+                                                               GTK_PARAM_READABLE));
+
   binding_set = gtk_binding_set_by_class (class);
   gtk_binding_entry_add_signal (binding_set,
                                GDK_Up, 0,
@@ -2626,7 +2640,11 @@ gtk_menu_paint (GtkWidget      *widget,
 
   if (event->window == widget->window)
     {
-      gint arrow_size = 0.7 * arrow_space;
+      gfloat arrow_scaling;
+      gint arrow_size;
+
+      gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL);
+      arrow_size = arrow_scaling * arrow_space;
 
       gtk_paint_box (widget->style,
                     widget->window,